第一个playbook, ansible ping 模块。 | 您所在的位置:网站首页 › ansible playbook模块 › 第一个playbook, ansible ping 模块。 |
用处:
用于测试ansible controller是否可以登录nodes及验证python是否可用的模块。 不是使用ICMP协议的ping, 如果想使用ICMP进行测试,可以使用net_ping模块。 参数:data: 如果data里填写的crash,就会返回错误。 返回值: 成功就会返回'pong' 使用:ping.yml - name: ping test hosts: test gather_facts: no tasks: - name: ping ping: 执行结果: [root@ansible testenv]# ansible-playbook ping.yml PLAY [ping test] ************************************************************************************************************************ TASK [ping] ***************************************************************************************************************************** ok: [ansible-1] ok: [ansible-2] PLAY RECAP ****************************************************************************************************************************** ansible-1 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 ansible-2 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 如果data参数里是crash,则返回以下,如果是其他字符,测试和没有一样。 An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Exception: boom |
CopyRight 2018-2019 实验室设备网 版权所有 |